package com.mall.czlr.base.common;

import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class ErrorResponse {
    private int code;
    private String message;

    public ErrorResponse() {
        this(0);
    }

    public ErrorResponse(int code) {
        this(code, null);
    }

    public ErrorResponse(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Map<String, Object> toMap() {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", code);
        result.put("message", message);
        return result;
    }
}
